import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 使用记录信息 */
export interface warehouseUsage {
          id: number; // 编号
          warehouseName?: string; // 库房名称
          type?: number; // 库房类型
          capacity?: number; // 规格（个）
          usedCount?: number; // 已使用（个）
          status?: number; // 使用状态
          address?: string; // 库房地址
          remark: string; // 备注
          updater: string; // 操作人
          attachmentUrl: string; // 附件地址
  }

// 使用记录 API
export const warehouseUsageApi = {
  // 查询使用记录分页
  getwarehouseUsagePage: async (params: any) => {
    return await request.get({ url: `/warehouseUsage/warehouse-usage/page`, params })
  },

  // 查询使用记录详情
  getwarehouseUsage: async (id: number) => {
    return await request.get({ url: `/warehouseUsage/warehouse-usage/get?id=` + id })
  },

  // 新增使用记录
  createwarehouseUsage: async (data: warehouseUsage) => {
    return await request.post({ url: `/warehouseUsage/warehouse-usage/create`, data })
  },

  // 修改使用记录
  updatewarehouseUsage: async (data: warehouseUsage) => {
    return await request.put({ url: `/warehouseUsage/warehouse-usage/update`, data })
  },

  // 删除使用记录
  deletewarehouseUsage: async (id: number) => {
    return await request.delete({ url: `/warehouseUsage/warehouse-usage/delete?id=` + id })
  },

  /** 批量删除使用记录 */
  deletewarehouseUsageList: async (ids: number[]) => {
    return await request.delete({ url: `/warehouseUsage/warehouse-usage/delete-list?ids=${ids.join(',')}` })
  },

  // 导出使用记录 Excel
  exportwarehouseUsage: async (params) => {
    return await request.download({ url: `/warehouseUsage/warehouse-usage/export-excel`, params })
  },
}